﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;

namespace Metro.Kashikoi.ServiceContract.Storage
{
    /// <summary>
    /// Provides the abstract base class for inventory of the storage.
    /// </summary>
    [DataContract(IsReference = true)]
    [KnownType(typeof(BinInventory))]
    [Table("Inventories")]
    public abstract class Inventory
    {
        /// <summary>
        /// Gets or sets Id.
        /// </summary>
        /// <value>
        /// The id.
        /// </value>
        [DataMember]
        [Key]
        [Range(0, int.MaxValue)]
        [RangeValidator(0, RangeBoundaryType.Inclusive, int.MaxValue, RangeBoundaryType.Inclusive)]
        public int Id { get; set; }

        /// <summary>
        /// Gets or sets name.
        /// </summary>
        /// <value>
        /// The name.
        /// </value>
        [DataMember]
        [Required]
        [StringLength(255, MinimumLength = 1)]
        [StringLengthValidator(1, 255)]
        public string Name { get; set; }

        /// <summary>
        /// Gets or sets the stock area id.
        /// </summary>
        /// <value>
        /// The stock area id.
        /// </value>
        [DataMember]
        [Range(1, int.MaxValue)]
        [RangeValidator(1, RangeBoundaryType.Inclusive, int.MaxValue, RangeBoundaryType.Inclusive)]
        public int StockAreaId { get; set; }

        /// <summary>
        /// Gets or sets the item id.
        /// </summary>
        /// <value>
        /// The item id.
        /// </value>
        [DataMember]
        [Range(1, int.MaxValue)]
        [RangeValidator(1, RangeBoundaryType.Inclusive, int.MaxValue, RangeBoundaryType.Inclusive)]
        public int ItemId { get; set; }

        /// <summary>
        /// Gets or sets the category id.
        /// </summary>
        /// <value>
        /// The category id.
        /// </value>
        [DataMember]
        [Range(1, int.MaxValue)]
        [RangeValidator(1, RangeBoundaryType.Inclusive, int.MaxValue, RangeBoundaryType.Inclusive)]
        public int CategoryId { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="Inventory"/> is deleted.
        /// </summary>
        /// <value>
        ///   <c>true</c> if deleted; otherwise, <c>false</c>.
        /// </value>
        [DataMember]
        public bool Deleted { get; set; }

        /// <summary>
        /// Gets or sets the trigger.
        /// </summary>
        /// <value>
        /// The trigger.
        /// </value>
        [DataMember]
        public virtual Trigger Trigger { get; set; }

        /// <summary>
        /// Gets or sets the container.
        /// </summary>
        /// <value>
        /// The container.
        /// </value>
        [DataMember]
        public virtual Container Container { get; set; }
    }
}
